package com.zhanglijie.theory.guardsuspension;

import lombok.SneakyThrows;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/8/11 0011 1:19
 */
public class ServerThread extends  Thread{
    private RequestQueue requestQueue;
    private String name;
    public ServerThread(RequestQueue requestQueue,String name){
        this.requestQueue = requestQueue;
        this.name = name;

    }
    @Override
    public void run() {
        for (int i = 0; i < 400; i++) {


            try {
                Request request = requestQueue.getRequest();
                System.out.println(this.name + "get request" + request.getName());
            }catch (Exception e){}

            // try {
            //     Thread.sleep(500);
            // }catch (Exception e){}
        }
    }
}
